package day1;

// 你继承什么你就是什么
public class Teacher extends Person{
	
	private double salary;
	

	public Teacher() {
		// super()，代表调用父类的无参构造方法：new Person()
		// 在java里面构造子类对象时候的时候会把父类对象同时构造出来.
		// super()调用父类无参构造方法，这个可以不写，不写java自动会给你加上
		super();
	}

	public Teacher(int id, String name, int age, String gender, double salary) {
		// new Person(int id, String name, int age, String gender) 
		super(id, name, age, gender);
		this.salary = salary;
	}
	
	// 重写、覆盖
	@Override
	public void show() {
		System.out.println("name: " + name + ", salary: " + salary);
	}

	public double getSalary() {
		return salary;
	}

	public void setSalary(double salary) {
		this.salary = salary;
	}

	@Override
	public String toString() {
		return "Teacher [salary=" + salary + ", id=" + id + ", name=" + name + ", age=" + age + ", gender=" + gender
				+ "]";
	}
	
	
}
